package day03;

public class ForDemo01 {
    public static void main(String[] args) {
        //打印10次Hello
        for(int i=1;i<=10;i++){
            System.out.println("Hello: "+i);
        }

        /*
            i=1     i<=10   打印  i++
            i=1     T       Hello  i++
            i=2     T        Hello  i++
            i=3     T       Hello   i++
            ......
            i=9     T       Hello  i++
            i=10    T       Hello  i++
            i=11    F
         */
        //求从1+2+3+...+99+100的和
        int sum = 0;
        for(int i=1;i<=100;i++){
//            sum = sum + i;
            sum += i;
        }
        System.out.println("sum="+sum);
        //求从1+3+5...+99的和
        sum = 0;
        for(int i=1;i<100;i+=2){
            sum += i;
        }
        System.out.println("100以内奇数和:"+sum);


    }
}
